from django.shortcuts import render
from .viewmethod import counts, query
from django.http import HttpResponse

METHODCOUNTS = counts.CountsData()
METHODQUERY = query.QueryData()


# 登录页面
def loginpage(request):
    return render(request, 'login.html')


# 查询页面
def index(request):
    return render(request, 'index.html')


def appQuery(request):
    return render(request, 'appQuery.html')


def webFunctionQuery(request):
    return render(request, 'webFunctionQuery.html')


def interfaceQuery(request):
    return render(request, 'interfaceQuery.html')


def cpuQuery(request):
    return render(request, 'cpuQuery.html')


def launchTime(request):
    return render(request, 'launchTime.html')


def memoryQuery(request):
    return render(request, 'memoryQuery.html')


# 登录接口
def login(request):
    return HttpResponse(METHODQUERY.user_login(request))


# cpu占有率
def cpu(request):
    return HttpResponse(METHODQUERY.cpu_rate(request))


# 启动App时间查询
def launchapp(request):
    return HttpResponse(METHODQUERY.launch_app(request))


# 内存占有率查询
def menapp(request):
    return HttpResponse(METHODQUERY.memory_app(request))


# 接口测试查询
def interface(request):
    return HttpResponse(METHODQUERY.interface_query(request))


# App功能测试查询
def functionapp(request):
    return HttpResponse(METHODQUERY.function_app_query(request))


# Web功能测试查询
def functionweb(request):
    return HttpResponse(METHODQUERY.function_web_query(request))


# 查询APP，WEB，接口功能测试用例总数
def functioncount(request):
    return HttpResponse(METHODCOUNTS.fun_counts(request))


# 查询APP 功能测试用例总数
def appfunctioncount(request):
    return HttpResponse(METHODCOUNTS.app_count(request))


# 查询WEB 功能测试用例总数
def webfunctioncount(request):
    return HttpResponse(METHODCOUNTS.web_fun_count(request))


# 查询接口 测试用例总数
def interfacecount(request):
    return HttpResponse(METHODCOUNTS.interface_count(request))


# 获取远程主机ip
def get_remote_ip(request):
    return HttpResponse(METHODCOUNTS.get_remote_ip(request))


# chrome driver 获取和添加
def chrome_driver_info(request):
    return HttpResponse(METHODQUERY.chrome_driver_info(request))


# 发送邮件
def send_email(request):
    return HttpResponse(METHODCOUNTS.send_email(request))
